<%-- 
    Document   : remoteRpt
    Created on : 2016-3-30, 17:37:30
    Author     : Administrator
--%>

<%@page import="com.cxhd.pacs.DataConfig"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script  type="text/javascript" src="${base}/js/jquery-1.9.1.js"></script>
        <script  type="text/javascript" src="${base}/js/jquery.cxhd.js"></script>
        <script  type="text/javascript" src="${base}/js/jquery.cxhd.js"></script>
        <link href='${base}/css/bootstrap-paper.css'  rel='stylesheet' type='text/css' />
        <link href='${base}/css/font-awesome.css'  rel='stylesheet' type='text/css' />
        <title class="xl_title"></title>
    </head>
    <body>
        <div style="position: fixed;top: 0;height: 50px;width: 100%">

            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="container">
                        <button style="float: right;margin-left: 10px;" class="btn btn-success btn-sm" onclick="rptCache()"><span class="fa fa-save"></span>&nbsp;&nbsp;缓存报告</button>
                        <button style="float: right;margin-left: 10px; display: none" class="btn btn-success btn-sm getcache" onclick="showCache()"><span class="fa fa-save"></span>&nbsp;&nbsp;提取缓存</button>

                        <button style="float: right;margin-left: 10px;" class="btn btn-success btn-sm" onclick="saveRpt()"><span class="fa fa-save"></span>&nbsp;&nbsp;保存</button>
                        <button style="float: right;margin-left: 10px;" class="btn btn-primary btn-sm" onclick="printRpt()"><span class="fa fa-save"></span>&nbsp;&nbsp;打印</button> &nbsp;&nbsp;&nbsp;&nbsp;

                        <div style="clear: both"></div>
                    </div>
                </div>
            </div>

        </div>

        <div  id="rpt" style="margin-top: 80px">
            <div style="font-size: 18px;max-height: 1200px;width: 804px;margin-left: auto;margin-right: auto;  background-image: none; background-color: rgb(251, 249, 249); background: #c7edcc">
                <!--            页头-->
                <div style="width: 100%;margin-top: 10px;height: 50xp;">

                </div>
                <!--            报告标题-->
                <div style='width:100%;height: 80px; line-height: 80px;text-align: center'>
                    <div style="height: 30px;font-size: 24px;font-weight: bold"><%= DataConfig.getInstance().getHospitalName()%>远程会诊系统</div>
                    <div style="height: 20px;font-size: 20px;">临床诊治报告</div>
                </div>
                <!--            信息头-->
                <div style='width:100%;height: 30px; line-height: 30px;text-align: center;margin-top: 30px;margin-bottom: 10px'>
                    <table style="width: 100%">
                        <tr>
                            <td width='250px' align='left'>
                                <label style="display: inline">申请医院及科室：</label>
                                <input type='text' style='display: inline;border: none;width: 80px;font-size: 18px' /></td>

                            <td style="width:260px;" align='right'>
                                <label style="display: inline">门诊/住院号：</label>
                                <input type='text' style='display: inline;border: none;width: 80px;font-size: 18px' />
                            </td>

                        </tr>
                    </table>
                </div>
                <!--            基本信息-->
                <div style='width:100%;border-top: 2px #000 solid;padding-bottom: 50px;border-bottom: 2px #000 dashed'>
                    <div style="width: 100%;margin-top: 20px;margin-bottom: 10px;margin-left: 20px;">
                        <div style="float: left"><label style="display: inline">患者姓名：</label><input id="xl_name" style="display: inline;border: none;width: 80px;font-size: 18px" type="text" /></div>
                        <div style="float: left"><label style="display: inline">性别：</label><input id="xl_sex" style="display: inline;border: none;width: 40px;font-size: 18px" type="text" /></div>
                        <div style="float: left"><label style="display: inline">年龄：</label><input id="xl_age" style="display: inline;border: none;width: 40px;font-size: 18px" type="text" /></div>
                        <div style="float: left"><label style="display: inline">床位：</label><input id="xl_bed" style="display: inline;border: none;width: 40px;font-size: 18px" type="text" /></div>
                        <div style="float: left"><label style="display: inline">贯籍：</label><input style="display: inline;border: none;width: 80px;font-size: 18px" type="text" /></div>
                        <div style="float: left"><label style="display: inline">职业：</label><input style="display: inline;border: none;width: 80px;font-size: 18px" type="text" /></div>

                        <div style="clear: both"></div>
                    </div>
                    <div  style="width: 100%;margin-top: 10px;margin-bottom: 10px;margin-left: 20px;" ><label style="display: inline">会诊方式：</label><input style="display: inline;border: none;font-size: 18px;width:300px" type="text" /></div>
                    <div  style="width: 100%;margin-top: 10px;margin-bottom: 10px;margin-left: 20px;"><label style="display: inline">会诊目的：</label><input style="display: inline;border: none;font-size: 18px;width: 300px" type="text" /></div>
                    <div style="width: 100%;margin-top: 10px;margin-bottom: 10px;margin-left: 20px;">
                        <div style="float: left">
                            <label style="display: inline">会诊专家：</label><input style="display: inline;border: none;width: 40px;font-size: 18px" type="text" />位</div>
                        <div  style="float: left;margin-left: 40px;"><label style="display: inline">所属医院及科室：</label><input style="display: inline;border: none;font-size: 18px" type="text" /></div>
                    </div>
                    <div style="clear: both"></div>
                </div>

                <!--            主体内容-->
                <div style='width:100%;margin-top: 10px;'>
                    <div style="width: 100%">
                        <div style="margin-left: 20px;">诊断意见：</div>
                        <div style='width: 760px;min-height:300px;margin-left: 20px;margin-right: 20px; ' contenteditable="true"></div>
                    </div>
                    <div style="width: 100%;margin-top: 10px;">
                        <div style="margin-left: 20px;">治疗意见：</div>
                        <div style='width: 760px;min-height:300px;margin-left: 20px;margin-right: 20px; '  contenteditable="true"></div>
                    </div>
                </div>
                <!--            签名 日期-->
                <div style='width:100%;border-bottom: 2px #000 solid;margin-top: 20px;padding-bottom: 10px'>
                    <div style="float: left"><label>专家签名：</label><input type='text' style="border: none;font-size: 18px"></div>
                    <div style="float: right">时间：<input type='text' style="border: none;font-size: 18px"></div>
                    <div style="clear: both"></div>
                </div>
                <!--            页脚-->
                <div style='width:100%;font-size: 14px;padding-top: 20px;'>
                    [注]：远程医疗会诊对病人的最终诊断与治疗的决定权属于收治病人的医疗机构；本中心会诊结果仅供参考。
                </div>

            </div>
        </div>
    </body>
</html>
<script type="text/javascript">
    
     
    var data = Request.QueryString("data");
    var item;
    if (data) {
        data = decodeURIComponent(data);
        item = JSON.parse(data);
    } else {
           item = JSON.parse('<%=request.getAttribute("pat_info")%>');
    }
    var order_id = '<%=request.getAttribute("order_id")%>';
     if(order_id){
         order_id.replace("null","");
     }
    //  var item =;
    // console.log(item);
    $("#xl_name").val(item.name);
    $("#xl_sex").val(item.sex);
    $("#xl_age").val(item.age);
    $(".xl_title").html(item.name + "的远程报告");

    function saveRpt() {
        $("input").each(function () {
            $(this).attr("value", $(this).val());
        });
        // return false;
        $.post("saveRemoteRpt", {order_id:order_id,host_id: item.host_id, event_name: "远程诊断报告", event_result: escape($("#rpt").html()), result_type: "html", hospital_name: '云县人民医院'}, function (data) {
            if (data == 'true') {
                steveAl("保存成功", 1000);
            }
        });
    }

    function rptCache() {
        $("input").each(function () {
            $(this).attr("value", $(this).val());
        });
        $.post("saveCacheRpt", {hostId: item.host_id, cacheName: "cacheRpt", cacheValue: escape($("#rpt").html())}, function (data) {
            if (data == 'true') {
                steveAl("保存成功", 1000);
            }
        });
    }
    var cacheData;
    function getCache() {
        $.post("getCacheRpt", {hostId: item.host_id, cacheName: "cacheRpt"}, function (data) {
            if (data != 'false') {
                cacheData = data;
                $(".getcache").show();
            }
        });

    }
    function showCache() {
        $("#rpt").html(unescape(cacheData));
    }

    function printRpt() {

        var obj = document.getElementById('rpt');
        var newWindow = window.open("打印窗口", "_blank");//打印窗口要换成页面的url
        var docStr = obj.innerHTML;
        newWindow.document.write(docStr);
        newWindow.document.close();
        newWindow.print();
        newWindow.close();

    }
    getCache();

</script>
